﻿<UserControl x:Class="Menafrinet.View.Controls.MergePanel"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:view="clr-namespace:Menafrinet.View"
             xmlns:core="clr-namespace:Menafrinet.Core;assembly=Menafrinet.Core"
             xmlns:p="clr-namespace:Menafrinet.View.Properties"
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="700" Loaded="UserControl_Loaded">
    <Grid x:Name="grdHome" VerticalAlignment="Stretch" Height="Auto" Style="{StaticResource GradientGrid}" SizeChanged="UserControl_SizeChanged" >
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <StackPanel Grid.Row="0" Grid.Column="1" x:Name="panelSiteMergeStatus" Background="{StaticResource DefaultButtonBrush}" >
            <StackPanel Margin="18, 8, 18, 8">
                <Label Foreground="White" FontSize="24" Content="{x:Static p:Resources.SiteMergeStatus}" />
                <DataGrid IsReadOnly="True" x:Name="dgSites" Height="700" Width="Auto"
                              RowHeaderWidth="0"
                      
                      RowStyle="{StaticResource SiteRowStyle}"
                      ItemsSource="{Binding Path=SiteCollection, IsAsync=True, FallbackValue=...}"
                  VirtualizingStackPanel.IsVirtualizing="True"
                  VirtualizingStackPanel.VirtualizationMode="Recycling"
                          AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="District" Binding="{Binding SiteName}" IsReadOnly="True" />
                    <DataGridTextColumn Header="Code" Binding="{Binding SiteCode}" IsReadOnly="True" />
                    <DataGridTextColumn Header="Date of last Merge" Binding="{Binding LastMerged, StringFormat='dd/MM/yyyy'}" IsReadOnly="True" />
                    <DataGridTextColumn Header="Days" Binding="{Binding DaysElapsed}" IsReadOnly="True" />
                </DataGrid.Columns>
            </DataGrid>
            </StackPanel>
        </StackPanel>

        <StackPanel Margin="8, 0, 8, 0" >
            <TextBlock Grid.Row="0" Grid.ColumnSpan="4" Style="{StaticResource PageHeaderTextBlockStyle}" Text="{x:Static p:Resources.TabMergeHeader}" />
            <StackPanel Height="20" />

            <Grid x:Name="grdExport">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                
                <StackPanel Grid.Row="1" Grid.Column="0" Margin="8, 8, 8, 8">

                    <!--<Button x:Name="btnImport" Style="{StaticResource FlatButtonStyle}" Height="Auto" Content="{x:Static p:Resources.ButtonMerge}" MaxWidth="330" MinWidth="250" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="18" Width="318" Click="btnImport_Click" />-->

                    <Button x:Name="btnOpenFolder" Style="{StaticResource FlatButtonStyle}" Height="Auto" Content="{x:Static p:Resources.OpenMergeFolder}" MaxWidth="330" MinWidth="250" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="18" Click="btnOpenFolder_Click" />
                <Grid Margin="0, 8, 0, 8">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                        <TextBlock FontWeight="DemiBold" FontSize="13" Margin="4" Grid.Row="0" Grid.Column="0" Text="{x:Static p:Resources.LastMergeDate}"></TextBlock>
                        <TextBlock FontWeight="DemiBold" FontSize="13" Margin="4" Grid.Row="1" Grid.Column="0" Text="{x:Static p:Resources.LastMergeUserID}"></TextBlock>
                        <TextBlock FontWeight="DemiBold" FontSize="13" Margin="4" Grid.Row="2" Grid.Column="0" Text="{x:Static p:Resources.RecordsMerged}"></TextBlock>
                        <TextBlock FontWeight="DemiBold" FontSize="13" Margin="4" Grid.Row="3" Grid.Column="0" Text="{x:Static p:Resources.PackagesMerged}"></TextBlock>

                    <TextBlock FontSize="13" Margin="4" Grid.Row="0" Grid.Column="1" Text="{Binding Source={x:Static p:Settings.Default}, Path=DateLastMerged, Mode=OneWay}"></TextBlock>
                    <TextBlock FontSize="13" Margin="4" Grid.Row="1" Grid.Column="1" Text="{Binding Source={x:Static p:Settings.Default}, Path=UserLastMerged, Mode=OneWay}"></TextBlock>
                    <TextBlock FontSize="13" Margin="4" Grid.Row="2" Grid.Column="1" Text="{Binding Source={x:Static p:Settings.Default}, Path=RecordsLastMerged, Mode=OneWay}"></TextBlock>
                    <TextBlock FontSize="13" Margin="4" Grid.Row="3" Grid.Column="1" Text="{Binding Source={x:Static p:Settings.Default}, Path=PackagesLastMerged, Mode=OneWay}"></TextBlock>

                        <StackPanel Margin="30, 0, 0, 0" Grid.Row="0" Grid.Column="3" Grid.RowSpan="10">
                            <TextBox IsReadOnly="True" Width="200" Height="100" VerticalScrollBarVisibility="Auto">
                                Instructions will go here.
                            </TextBox>
                        </StackPanel>
                    
                    </Grid>
                <StackPanel Height="5" />
                    <Button x:Name="btnImport" Style="{StaticResource FlatButtonStyle}" Height="Auto" Content="{x:Static p:Resources.ButtonMerge}" MaxWidth="250" MinWidth="200" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="14" Click="btnImport_Click" />
                    <!--<Button x:Name="btnOpenFolder" Style="{StaticResource FlatButtonStyle}" Height="Auto" Content="{x:Static p:Resources.OpenMergeFolder}" MaxWidth="250" MinWidth="200" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="14" Click="btnOpenFolder_Click" />-->
            </StackPanel>
        </Grid>

                    <StackPanel Margin="8, 0, 8, 0">
                <Label Content="{x:Static p:Resources.MergeStatus}" HorizontalAlignment="Left" />
                <TextBox Grid.Row="1" Height="160" VerticalScrollBarVisibility="Visible" x:Name="txtImportStatus" VerticalAlignment="Top" HorizontalAlignment="Stretch" Text="" IsReadOnly="True" Visibility="Visible">
                    
                </TextBox>
                <StackPanel Height="10" />
                        <ProgressBar x:Name="importProgressBar" Value="0" Height="32" />
                    </StackPanel>

                </StackPanel>

    </Grid>
</UserControl>
